package com.hanggold.aspose;

import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;

import java.io.File;

/**
 * @author <a href="mailto:sunmch@163.com">smc</a>
 * @date 2019-09-24 13:28
 * @since 1.0.0
 **/
public class PPT2PDF {
    public static void main(String[] args) throws Exception {

        long start = System.currentTimeMillis();
//        InputStream license = PPT2ImageDemo.class.getClassLoader().getResourceAsStream("license.xml");
//        if (license != null) {
//            License aposeLic = new License();
//            aposeLic.setLicense(license);
//        }
        Presentation presentation = new Presentation("H:" + File.separator + "ljj.pptx");

//        FileInputStream fileInput = new FileInputStream("H:" + File.separator + "ljj.pptx");
//        Presentation pres = new Presentation(fileInput);
//
//        PdfOptions pdfOptions=new PdfOptions();
//        pdfOptions.setJpegQuality((byte)100);
//        pdfOptions.setSaveMetafilesAsPng(true);
//        pdfOptions.setTextCompression(0);
//        pdfOptions.setCompliance(15);
//        FileOutputStream out = new FileOutputStream(new File("H:" + File.separator + "33333.pdf"));
//        pres.save(out, SaveFormat.Pdf,pdfOptions);
//        pres.save(out, SaveFormat.Pdf);
//        out.close();

        presentation.save("H:" + File.separator + "output.pdf", SaveFormat.Pdf);
        System.out.println("success");

        long end = System.currentTimeMillis();

        System.out.printf("转换pdf花费时间 :  %d \n", (end - start));



    }
}
